import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
def pf(x):
ans = 0
while x%2 == 0:
ans += 1
x = x//2
p = 3
while p*p <= x:
while x%p == 0:
ans += 1
x = x//p
p += 2
if x > 1: ans += 1
return ans
t = int(input())
for tidx in range(t):
a,b,k = [int(x) for x in input().split()]
ans = (pf(a)+pf(b)) >= k
if ans and k>1:
print("YES")
elif (a%b == 0 or b%a == 0) and k==1 and a != b: print("YES")
else: print("NO")
#include <bits/stdc++.h>
using namespace std;
#define f(i, a, b) for (ll i = a; i < b; i++)
#define fr(i, a, b) for (ll i = b - 1; i >= a; i--)
#define fa(x) for (auto ele : x)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define db double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ppiii pair<pair<int, int>, int>
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vs vector<string>
#define v(ele) vector<ele>
#define sei set<int>
#define sel set<ll>
#define ses set<string>
#define sec set<char>
#define se(ele) set<ele>
#define mii map<int, int>
#define mll map<ll, ll>
#define m(e1, e2) map<e1, e2>
#define mipii map<int, pii>
#define mcpii map<char, pii>
#define mcpci map<char, pair<char, int>>
#define mpiii map<pair<char, int>, int>
#define mic map<int, char>
#define mci map<char, int>
#define mcsei map<char, sei>
#define mlsel map<ll, sel>
#define mcvi map<char, vi>
#define mci map<char, int>
#define msi map<string, int>
#define misei map<int, sei>
#define mlvl map<ll, vl>
#define mivi map<int, vi>
#define mlpll map<ll, pll>
#define mplll map<pll, ll>
#define qi queue<int>
#define ql queue<ll>
#define qpii queue<pair<int, int>>
const ll mod = 1e9 + 7;
const ll INF = 1e16;
const ll NEG_INF = LONG_LONG_MIN;
const ll N = 31634;
// const int N = 51;
set<int> primes;
bool com[N];
void seive()
{
f(i, 2, N)
{
if (com[i] == 0)
{
primes.insert(i);
for (int j = i * i; j < N && j > 0; j += i)
{
com[j] = 1;
}
}
}
}
void YN(bool possible)
{
if (possible)
{
cout << "YES\n";
}
else
{
cout << "NO\n";
}
}
void count(int n, int &k)
{
if (k < 1)
{
return;
}
// int ans = 0;
auto it = primes.begin();
while (it != primes.end() && *it < sqrt(n) + 1)
{
int i = *it;
it++;
if (n % i == 0)
{
while (n % i == 0)
{
// ans++;
k--;
n /= i;
if (k < 1)
{
return;
}
}
}
if (k < 1)
{
return;
}
}
if (n != 1)
{
// ans++;
k--;
}
// return ans;
return;
}
void solve()
{
int a, b, k;
cin >> a >> b >> k;
if (k > 70)
{
YN(0);
return;
}
int g = __gcd(a, b);
int mini = 1 + (g != min(a, b));
bool p1 = (a != b || k > 1), p2 = (k >= mini);
count(a, k);
count(b, k);
YN(k < 1 && p1 && p2);
return;
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(0);
int t = 1;
seive();
cin >>
t;
while (t--)
{
solve();
}
return 0;
}
1062B - Math | 1294C - Product of Three Numbers |
749A - Bachgold Problem | 1486B - Eastern Exhibition |
1363A - Odd Selection | 131B - Opposites Attract |
490C - Hacking Cypher | 158B - Taxi |
41C - Email address | 1373D - Maximum Sum on Even Positions |
1574C - Slay the Dragon | 621A - Wet Shark and Odd and Even |
1395A - Boboniu Likes to Color Balls | 1637C - Andrew and Stones |
1334B - Middle Class | 260C - Balls and Boxes |
1554A - Cherry | 11B - Jumping Jack |
716A - Crazy Computer | 644A - Parliament of Berland |
1657C - Bracket Sequence Deletion | 1657B - XY Sequence |
1009A - Game Shopping | 1657A - Integer Moves |
230B - T-primes | 630A - Again Twenty Five |
1234D - Distinct Characters Queries | 1183A - Nearest Interesting Number |
1009E - Intercity Travelling | 1637B - MEX and Array |